﻿<navigation:Page x:Class="TravelAgencySilverlight.Views.Trips" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:VM="clr-namespace:TravelAgencySilverlight.ViewModels"
           xmlns:Converters="clr-namespace:TravelAgencySilverlight.Views.Converters"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Trips Page" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:TravelAgencySilverlight.Web.Services" xmlns:my1="clr-namespace:TravelAgencySilverlight.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <navigation:Page.Resources>
        <Converters:ByteArrayToImageSource x:Key="ByteArrayToImageSourceConverter" />
        <Converters:BytaArrayToUri x:Key="BytaArrayToUriConverter" />
    </navigation:Page.Resources>
    <navigation:Page.DataContext>
        <VM:ViewModelTrips x:Name="ViewModelTrips" />
    </navigation:Page.DataContext>
    <Grid x:Name="LayoutRoot">
        <ScrollViewer MaxHeight="600">
            <StackPanel>
                <TextBlock Text="In Progress" />
                <ListBox ItemsSource="{Binding Photos}" >
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <TextBlock Text="{Binding PhotoName}" />
                                <!--<MediaElement Source="{Binding PhotoContent, Converter={StaticResource BytaArrayToUriConverter}}" 
                                              MinWidth="50" 
                                              MaxWidth="80" AutoPlay="True"  >
                                    
                                </MediaElement>-->
                                <Image MaxHeight="50" 
                                       MinWidth="50" 
                                       MaxWidth="80"
                                    Source="{Binding PhotoContent, Converter={StaticResource ByteArrayToImageSourceConverter}}" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            
            </StackPanel>
        </ScrollViewer>

        <!--<telerik:RadGridView 
                Height="261" 
                ItemsSource="{Binding ElementName=photoDomainDataSource, Path=Data}" 
                Name="photoRadGridView" Width="423" 
                AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="name" DataMemberBinding="{Binding Name}" />
                <telerik:GridViewImageColumn 
                        Header="image" 
                        DataMemberBinding="{Binding PhotoContent, Converter={StaticResource ByteArrayToImageSourceConverter}}" />

            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
        <riaControls:DomainDataSource 
                AutoLoad="True" 
                d:DesignData="{d:DesignInstance my1:Photo, CreateList=true}" 
                Height="0" 
                LoadedData="photoDomainDataSource_LoadedData_1" 
                Name="photoDomainDataSource" 
                QueryName="GetPhotosQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:TravelAgencyDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>-->
    </Grid>
</navigation:Page>
